// pages/hot/hot.js
Component({
  options: {
    addGlobalClass: true,
  },
  data: {
    issues :[],
  },
  attached() {
    var db = wx.cloud.database() // 初始化db链接
    console.log(db.serverDate())
    db.collection('punchline').orderBy('createTime', 'desc').get().then(res => {
      console.log("success")
      var _collections = new Array()
      for (var i = 0; i < res.data.length; i++) {
        _collections.push(JSON.parse(JSON.stringify(res.data[i])))
      }
      this.setData({
        issues: _collections,
      })
    }).catch(res=>{
      console.log("fail")
    })
  },
})